3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
QuickDraw 3D provides a programming interface by which you can add new group objects to the class TQ3GroupObject . This section first describes the Q3XGroup_GetPositionPrivate function, by which you can access the private data in your group object, and then lists the methods that may be called.
You can use the Q3XGroup_GetPositionPrivate function to return the private data stored in a group object.
void Q3XGroup_GetPositionPrivate (
TQ3GroupObject group,
TQ3GroupPosition position);
The TQ3XGroupAcceptObjectMethod method reports whether a group will accept a particular object type.
TQ3Boolean (*TQ3XGroupAcceptObjectMethod) (
TQ3GroupObject group,
TQ3Object object);
The TQ3XGroupAddObjectMethod method adds an object to a group.
TQ3GroupPosition (*TQ3XGroupAddObjectMethod) (
TQ3GroupObject group,
TQ3Object object);
The TQ3XGroupAddObjectBeforeMethod method adds an object before a given position in a group.
TQ3GroupPosition (*TQ3XGroupAddObjectBeforeMethod) (
TQ3GroupObject group,
TQ3GroupPosition position,
TQ3Object object);
The TQ3XGroupAddObjectAfterMethod method adds an object after a given position in a group.
TQ3GroupPosition (*TQ3XGroupAddObjectAfterMethod) (
TQ3GroupObject group,
TQ3GroupPosition position,
TQ3Object object);
The TQ3XGroupSetPositionObjectMethod method replaces an object in a group.
TQ3Status (*TQ3XGroupSetPositionObjectMethod) (
TQ3GroupObject group,
TQ3GroupPosition gPos,
TQ3Object obj);
The TQ3XGroupRemovePositionMethod method replaces an object in a group.
TQ3Object (*TQ3XGroupRemovePositionMethod) (
TQ3GroupObject group,
TQ3GroupPosition position);
The TQ3XGroupGetFirstPositionOfTypeMethod method gets the position of the first object of a specified type in a group.
TQ3Status (*TQ3XGroupGetFirstPositionOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType,
TQ3GroupPosition *gPos);
The TQ3XGroupGetLastPositionOfTypeMethod method gets the position of the last object of a specified type in a group.
TQ3Status (*TQ3XGroupGetLastPositionOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType,
TQ3GroupPosition *gPos);
The TQ3XGroupGetNextPositionOfTypeMethod method gets the position of the next object of a specified type in a group.
TQ3Status (*TQ3XGroupGetNextPositionOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType,
TQ3GroupPosition *gPos);
The TQ3XGroupGetPrevPositionOfTypeMethod method gets the position of the previous object of a specified type in a group.
TQ3Status (*TQ3XGroupGetPrevPositionOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType,
TQ3GroupPosition *gPos);
The TQ3XGroupCountObjectsOfTypeMethod method returns the number of objects of a specified type in a group.
TQ3Status (*TQ3XGroupCountObjectsOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType,
unsigned long *nObjects);
The TQ3XGroupEmptyObjectsOfTypeMethod method disposes of all the objects of a specified type in a group.
TQ3Status (*TQ3XGroupEmptyObjectsOfTypeMethod) (
TQ3GroupObject group,
TQ3ObjectType isType);
The TQ3XGroupGetFirstObjectPositionMethod method gets the position of the first instance of an object in a group.
TQ3Status (*TQ3XGroupGetFirstObjectPositionMethod) (
TQ3GroupObject group,
TQ3Object object,
TQ3GroupPosition *gPos);
The TQ3XGroupGetLastObjectPositionMethod method gets the position of the last instance of an object in a group.
TQ3Status (*TQ3XGroupGetLastObjectPositionMethod) (
TQ3GroupObject group,
TQ3Object object,
TQ3GroupPosition *gPos);
The TQ3XGroupGetNextObjectPositionMethod method gets the position of the next instance of an object in a group.
TQ3Status (*TQ3XGroupGetNextObjectPositionMethod) (
TQ3GroupObject group,
TQ3Object object,
TQ3GroupPosition *gPos);
The TQ3XGroupGetPrevObjectPositionMethod method gets the position of the previous instance of an object in a group.
TQ3Status (*TQ3XGroupGetPrevObjectPositionMethod) (
TQ3GroupObject group,
TQ3Object object,
TQ3GroupPosition *gPos);
The TQ3XMethodTypeGroupPositionSize method gets the size of your group position private data.
unsigned long TQ3XMethodTypeGroupPositionSize;
The TQ3XGroupPositionNewMethod method makes a new group position in a group object.
TQ3Status (*TQ3XGroupPositionNewMethod) (
void *gPos,
TQ3Object object,
const void *initData);
The TQ3XGroupPositionCopyMethod method copies a group position in a group object.
TQ3Status (*TQ3XGroupPositionCopyMethod) (
void *srcGPos,
void *dstGPos);
The TQ3XGroupPositionDeleteMethod method deletes a group position in a group object.
TQ3Status (*TQ3XGroupPositionDeleteMethod) (void *gPos);
The TQ3XGroupStartIterateMethod method helps draw a view by iteration. It is called once when drawing begins and returns the first object to be drawn.
TQ3Status (*TQ3XGroupStartIterateMethod) (
TQ3GroupObject group,
TQ3GroupPosition *iterator,
TQ3Object *object,
TQ3ViewObject view);
The TQ3XGroupStartIterateMethod method finds the first object to be drawn in view and returns it in the object parameter. If the returned object value is NULL , then GroupEndIterate will not be called. The iterator parameter is uninitialized when GroupStartIterate is called.
TQ3Status GroupStartIterate(
TQ3GroupObject group,
TQ3GroupPosition *iterator,
TQ3Object *object,
TQ3ViewObject view)
{
// initialize gPos and object
*iterator = NULL;
*object = NULL;
// get position of first object in group
if (Q3Group_GetFirstPosition(group, iterator) == kQ3Failure)
return kQ3Failure;
if (*iterator == NULL)
return kQ3Success;
// get first object in group
if (Q3Group_GetPositionObject(group, *iterator, object)
== kQ3Failure)
return kQ3Failure;
return kQ3Success;
}
The TQ3XGroupEndIterateMethod method helps draw a view by iteration. It is called repeatedly while a group is traversed, returning the next object to be drawn each time.
TQ3Status (*TQ3XGroupEndIterateMethod) (
TQ3GroupObject group,
TQ3GroupPosition *iterator,
TQ3Object *object,
TQ3ViewObject view);
The TQ3XGroupEndIterateMethod method is called repeatedly with the previous object and iterator values. It returns in object the next object to be drawn, or NULL when when there are no more objects to be drawn. It is your responsibility to dispose of object .
TQ3Status GroupEndIterate(
TQ3GroupObject group,
TQ3GroupPosition *iterator,
TQ3Object *object,
TQ3ViewObject view)
{
if (*object != NULL) {
// dispose previous object
Q3Object_Dispose(*object);
*object = NULL;
// get position of next object in group
if (Q3Group_GetNextPosition(group, iterator) == kQ3Failure)
return kQ3Failure;
if (*iterator == NULL)
return kQ3Success;
// get next object in group
return Q3Group_GetPositionObject(group, *iterator, object);
} else {
*iterator = NULL;
return kQ3Success;
}
}
The TQ3XGroupEndReadMethod method is a cleanup method that is called when a group has been completely read.
TQ3Status (*TQ3XGroupEndReadMethod) (TQ3GroupObject group);
Previous | QD3D Book | Overview | Chapter Contents | Next |